Skip to content

Remove unwanted inner try block#2741

Open
SougandhS wants to merge 1 commit into
eclipse-platform:masterfrom
SougandhS:RemoveUnwantedTryCatchBlock
Open

Remove unwanted inner try block#2741
SougandhS wants to merge 1 commit into
eclipse-platform:masterfrom
SougandhS:RemoveUnwantedTryCatchBlock

Conversation

@SougandhS

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  +    51      54 suites  +51   52m 23s ⏱️ + 52m 13s
 4 671 tests + 4 578   4 649 ✅ + 4 556   22 💤 + 22  0 ❌ ±0 
11 907 runs  +11 813  11 754 ✅ +11 660  153 💤 +153  0 ❌ ±0 

Results for commit e21f968. ± Comparison against base commit c62b803.

♻️ This comment has been updated with latest results.

}
} catch (Exception e) {
DebugPlugin.log(e);
if (attr.startsWith(MULTI_LAUNCH_CONSTANTS_PREFIX)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of exception might happen? Do you really want the whole loop to terminate if there is an exception?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since neither startsWith() nor removeAttribute() declares any exceptions, I initially thought the inner try/catch could be removed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It all looks a little overly cautious given that nothing declares any thrown exceptions. It looks like it's always been there so there's no real accounting for why either of those try blocks are there, neither the inner nor the outer. Maybe it happened during some initial implementation and was then never cleaned up. I'm not sure what to say about that. 😞

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked other references of removeAttribute(), and they don't have a similar try/catch. Since neither API declares any exceptions, the inner try/catch may just be leftover from an older implementation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do other places have the outer try block? It all looks a bit bogus...

@SougandhS SougandhS Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only place I found a try block is in org.eclipse.jdt.debug.ui.launchConfigurations.JavaDependenciesTab.performApply(ILaunchConfigurationWorkingCopy) but that is only for catching CoreException (which is for org.eclipse.debug.core.ILaunchConfiguration.getAttribute(String, boolean) )
image

everywhere else is try-catch free..

@SougandhS SougandhS force-pushed the RemoveUnwantedTryCatchBlock branch from 7cd6483 to d3a1ab6 Compare June 8, 2026 05:25

@merks merks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s okay then. Thanks for checking.

@SougandhS

Copy link
Copy Markdown
Contributor Author

It’s okay then. Thanks for checking.

Thanks!

@SougandhS SougandhS force-pushed the RemoveUnwantedTryCatchBlock branch from d3a1ab6 to e21f968 Compare June 8, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants